#include <cstdio>
#include "ui.h"

Ui& Ui::msg(const Ui::lvl_t lvl, const std::string who)
{
	msglvl = lvl;
	msgfrom = who;	
	msgdata.clear();
	return *this;
}

void Ui::operator<<(const Ui::end)
{
  log(msglvl, msgfrom, msgdata);
}

Ui& Ui::operator<<(const std::string& in)
{
	msgdata.append(in);
	return *this;
}

Ui& Ui::operator<<(const char* in)
{
	msgdata.append(in);
	return *this;
}

Ui& Ui::operator<<(const int& in)
{
	char tmp[48];
	sprintf(tmp, "%d", in);
	msgdata.append(tmp);
	return *this;
}

void Ui::setMsgLevel(lvl_t newlvl)
{
  output_msglvl = newlvl;
}
